<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../inc_jqgrid.jsp"/>
    <meta http-equiv="X-UA-Compatible" content="edge" />
    <title>采购商信息列表</title>
    <link rel="stylesheet" href="${ctx}/css/iconfont.css"/>
    <style>

        select{
            height:20px;
            border:1px solid #cdcdcd;
        }
        .searchBox{
            width:1300px;
            height:27px;
            margin:15px 15px;
        }
        .searchBox li{
            float:left;
            margin-top:5px;
            margin-left:5px;
        }
        .tableOntab td{
            height:37px;
            border-right:none;
        }
        .tableOntab .borderNone{
            border-bottom:none;
        }
        .query{
            margin-left:5px;
        }
        /*使按钮居中*/
        .autoBoxTwo{
            width:180px;
            height:26px;
            margin:15px auto;
        }
        input::-ms-clear{display:none;}
    </style>

    <script type="text/javascript">
        $(function(){
            $("#jqTable").jqGrid({
                url: '${ctx}/user/selectNoAudit?temp='+Math.random(),
                mtype: "GET",
                styleUI:'Bootstrap',
                datatype: "json",
                shrinkToFit: true,//按比例初始化列宽度
                viewrecords: true,//是否要显示总记录数
                rownumbers: true,//显示行顺序号
                rownumWidth: 35,//顺序号宽度
                //multiselect: true,//定义是否可以多选
                //multiboxonly: true,//为ture时只有选择checkbox才会起作用
                height : "100%", //"100%"
                rowNum: 20,//每页行数
                rowList : [ 10, 20, 55 ],//调整表格显示的记录数
                autowidth: true,
                pager: "#jqGridPager",
                caption: "",//标题
                colModel: [
                    { label: 'ID', name: 'id',index:'id', key: true, width: 75,hidden:true},
                    { label: 'ID', name: 'orgId', width: 75,hidden:true},
                    { label: '用户名', name: 'username', width: 150 },
                    { label: '昵称', name: 'nickname', width: 150 },
                    { label: '公司名称', name: 'company', width: 150 },
                    { label:'联系人', name: 'contacts', width: 150 },
                    { label:'手机', name: 'mobile', width: 150 },
                    { label:'审核状态', name: 'state', width: 150 ,
                        formatter: function (value, ops, rows) {
                            return CommonConverter.buyerStateToStr(value);
                        }
                    },
                    { label:'注册时间', name: 'createTime', width: 150 },
                    { label:'操作', name: 'action', width: 150 ,
                        formatter: function (value, ops, rows) {
                            if(rows.state == 1){
                            	var str ='<i class="icon iconfont" title="审核" onclick=check("'+rows.id+'")>&#xe604;</i>';
                                return str;
                            }else{
                                return "";
                            }
                        }
                    }
                ]
            });
            //点击查询 重新加载列表
            $("#query").click(function(){
                //获取参数
                var username=$("#username").val();
                var nickname=$("#nickname").val();
                var company=$("#company").val();
                var contact=$("#contact").val();
                var params = {
                    "username" : username,
                    "nickname" : nickname,
                    "company" : company,
                    "contact" : contact
                };
                var postData = $("#jqTable").jqGrid("getGridParam", "postData");
                $.extend(postData, params);  //(9)将postData中的查询参数覆盖为空值
                jQuery("#jqTable").jqGrid('setGridParam',
                        {
                            url:"${ctx}/user/selectNoAudit"
                        }).trigger("reloadGrid", [{page:1}]);
            });
           

        });
        //审核
        function check(id){
        	var url='${ctx}/np/buyerAudit/'+id;
        	window.location.href=url;
        };
    </script>
</head>
<body>
<jsp:include page="../head.jsp"></jsp:include>
<div class="divBox">
    <ul class="searchBox">
        <li>用户名：<input  id="username" style="height:22px;"/></li>
        <li>昵称：<input  id="nickname" style="height:22px;"/></li>
        <li>公司名称：<input  id="company" style="height:22px;"/></li>
        <li>联系人：<input  id="contact" style="height:22px;"/></li>
        <li>
        审核状态：
        <select id="state" style="width: 73px;">
            <option value="-1">全部</option>
            <option value="1">待审核</option>
            <option value="2">未通过</option>
            <option value="0">已通过</option>
        </select>
        </li>
        <%-- <li>
             押金归属：
             <select id="owner" style="width: 83px;">
                 <option value="-1">全部</option>
                 <option value="1">安科</option>
                 <option value="2">伊翔</option>
             </select>
         </li>--%>
        <li><button class='query' id="query">查询</button></li>
    </ul>
    <table id="jqTable" ></table>
    <div id="jqGridPager"></div>
</div>
<script type="text/javascript" src="${ctx }/jslib/airport/fixdiv.js"></script>
<script type="text/javascript" src="${ctx }/jslib/airport/address.js"></script>
<jsp:include page="../footer.jsp"></jsp:include>
</body>
</html>
